<template>
  <el-form-item label="">
    <input-files v-if="'file'==type"
                 :data-file="value"
                 :file-disk="fileDisk"
                 :preview="true"
                 :readonly="false"
                 :file-upload-timely="true"
                 v-on:change="(v)=>{input=v}"
    ></input-files>
    <el-input v-else-if="'textarea'==type" type="textarea" v-model="input"></el-input>


    <input-rich-editor v-else-if="'textrich'==type" :value="value"
                       v-on:change="(v, editor)=>{input=v}" :enable-media="fileDisk"></input-rich-editor>

    <el-input v-else v-model="input"></el-input>
  </el-form-item>

</template>


<script>

export default {
  name: 'variableFormItemValue',
  props: {
    type: {
      type: String,
      default: ''
    },
    value:{
      type: [String,Object],
      default: function (){
        return ''
      }
    },
    label: {
      type: String,
      default: ''
    },
    fileDisk: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      input:''
    }
  },
  computed: {},
  created() {
    this.input = this.value
  },
  mounted() {
  },
  watch: {
    input: {
      handler(newValue, oldValue) {
        this.$emit('change', newValue)
      },
      deep: true
    }
  },
  methods: {}
}
</script>
